<?php 
$userid = $this->session->userdata('userid');
if($userid!=NULL && (isset($userid))){
?>
<fieldset id="commentField">
<legend>Comment</legend>
<form id="commentForm" name="commentForm" action="<?php echo site_url('home/add_comment')?>" method="post">
<?php echo form_error('comment');?>
<textarea id="comment" name="comment" cols="40" rows="10">

</textarea>
<input type="submit" name="postComment" value="Comment"/>
</form>
</fieldset>
<?php } else {
    echo "<p>You must login to comment</p>";
}?>